<?php
namespace Home\Controller;
class MyController extends NavController
{
public function __construct()
{
    parent::__construct();
    $memberId = session('m_id');
    if(!$memberId){
        session('returnUrl',U('My/'.ACTION_NAME));
        redirect(U('Member/login'));
    }
}
    public function order(){
        $orderModel = D('Admin/Order');
        $data = $orderModel->search();
        $this->assign(array(
           'data'=>$data,
            '_page_title'=>'个人中心-我的订单',
        ));
    $this->display();
}
    public function order_detail(){
        $orderId = I('get.order_id',0);
        $orderModel = D('Admin/Order');
        $data = $orderModel->getDetail($orderId);
        $this->assign(array(
            'order'=>$data,
            '_page_title'=>'个人中心-我的订单',
        ));
        $this->display();
    }

    public function setReceived(){
        $orderId = I('get.id');
        $model = D('Order');
        $data['post_status'] = 2;
        if($model->where('id='.$orderId)->save($data)){
            $this->success('签收成功!',U('order_detail',array('id'=>I('get.id',1))));
            exit;
        }
        $this->error($model->getError());
    }
}